package com.spotalog.shared.service.rest;

import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import lombok.AccessLevel;
import lombok.Data;
import lombok.NoArgsConstructor;

import com.google.common.collect.ImmutableList;

@Data
@XmlRootElement
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@XmlAccessorType(XmlAccessType.FIELD)
public class Envelope<T> {
	private List<T> results;
	private String cursor;
	private int count;

	public Envelope(Iterable<? extends T> results, int count,
			String cursorString) {
		this.results = ImmutableList.copyOf(results);
		this.count = count;
		this.cursor = cursorString;
	}
}
